package com.assignwork.dto;

import com.assignwork.entity.WorkLineLog;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;

import org.springblade.core.tool.utils.Func;

/**
 * (WorkLineLog)DTO
 * @since 2024-05-28 11:01:01
 */
@Data
@ApiModel(value = "WorkLineLogDTO", description = "")
public class WorkLineLogDTO extends WorkLineLog  {
    
    @JsonSerialize(using = ToStringSerializer.class)
    private Long planId;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long lineId;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long arrangeId;

    List<WorkLineLogMachineDTO> machine;
    List<WorkLineLogInfoDTO> info;

    public List<WorkLineLogMachineDTO> getMachine() {
        if (Func.isNotEmpty(machine)) {
            for (WorkLineLogMachineDTO dto : machine) {
                dto.setLogId(getId());
                dto.setPlanId(getPlanId());
                dto.setLineId(getLineId());
                dto.setArrangeId(getArrangeId());
            }
        }
        return machine;
    }

    public List<WorkLineLogInfoDTO> getInfo() {
        if (Func.isNotEmpty(info)) {
            for (WorkLineLogInfoDTO info : info) {
                info.setLogId(getId());
                info.setPlanId(getPlanId());
                info.setLineId(getLineId());
                info.setArrangeId(getArrangeId());
            }
        }
        return info;
    }
}

